package com.lipp.luosu.constant;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

/**
 * @ClassNameMain
 * @description: TODO 类描述
 * @Author lipp
 * @Date 2024/1/24 8:55
 * @Version 1.0
 */
public class Main {

    private static List<String> prefixList = new ArrayList<>();

    static {
        // 假设这些是合法的手机号码前缀
        prefixList.add("130");
        prefixList.add("131");
        prefixList.add("132");
        // ... 添加更多合法前缀
    }

    public static void main(String[] args) throws InterruptedException {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            String prefix = prefixList.get(new Random().nextInt(prefixList.size()));

            if (i % 1000 == 0) {
                prefix = "00";
            }

            StringBuilder phoneNumberBuilder = new StringBuilder(prefix);
            for (int j = 0; j < 8; j++) {
                phoneNumberBuilder.append((int) (Math.random() * 10)); // 生成后8位数字
            }
            String result = phoneNumberBuilder.toString();
//            CompletableFuture<Void> voidCompletableFuture = CompletableFuture.supplyAsync(i -> {
//               // CompareUtil.isTestOne(result);
//
//                boolean testTwo = CompareUtil.isTestTwo(result);
//                System.out.println(i + " " + testTwo);
//
//            });

            //  CompletableFuture.completedFuture(result).thenAcceptAsync(data -> {
            System.out.println(CompareUtil.isTestOne(result));
            // });
        }


        long end = System.currentTimeMillis();
        System.out.println("耗时：" + (end - start) + "ms");
        Thread.sleep(1000000);


    }
}
